<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://ckeditor.com" prefix="ckeditor" %>
<%@page import="com.ckeditor.CKEditorConfig"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Map"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<%@ include file="/static/htm/head" %>
		<title>游戏论坛帖子专区</title>
	</head>
	<body style="font-size:15px;">
		<div style="text-align: center;">
			<a href="index.jsp">
				<img alt="论坛Logo" height="56" src="static/pic/logo.jpg" width="192">
			</a>
		</div>
		<table width="100%">
			<tr>
				<td>
					<a href="postlist?id=${game.id }">
						返回帖子列表
					</a>
				</td>
				<td style="text-align: right;">
					<%@ include file="/static/htm/user.jsp" %>
				</td>
			</tr>
		</table>
	<div style="width:50%;position:relative;left:25%;">
		<form action="permit/post" method="post">
			<table width="100%">
				<tr>
					<td width="30%">游戏版块</td>
					<td width="70%"><font color="red">${game.name}</font></td>			
				</tr>
				<tr>
					<td width="30%">
					标题
					</td>
					<td width="70%">
						<input type="text" name="title" style="width:556px;" id="title">
					</td>
				</tr>
			</table>
			<% 
				Map<String, String> attr = new HashMap<String, String>();
				attr.put("rows", "8");
				attr.put("cols", "50");
				CKEditorConfig settings = new CKEditorConfig();
				settings.addConfigValue("width", "100%");
				settings.addConfigValue("height","300px");
				settings.addConfigValue("toolbar", "Forum");
			%>
			<ckeditor:editor textareaAttributes="<%=attr %>"
				basePath="/gameforum/ckeditor/" config="<%=settings %>"
				editor="content" value="${value }"/>
			<div id="error_info" class="alert alert-error" style="margin-top:10px;visibility:${visibility};">
        		${reason }
      		</div>
      		<input type="hidden" value="${game.id }" name="id">
			<input type="submit" value="发表帖子" class="btn btn-success" id="submit"/>
		</form>
			<div style="border-width:1px;border-color:#0B85FF;border-style:solid;">
				游戏论坛文明公约<br>
				一、守法正直。不触及敏感政治话题，不发表极端言论。在涉及公众利益、公共秩序等问题时，应遵守国家法律法规、社会伦理道德；<br>
				二、尊重他人，包容友爱。反对人身攻击、地域攻击等伤害论坛用户感情的言语和行为；<br>
				三、文明发言，礼貌待人。反对色情暴力等不健康内容，反对侮辱、谩骂等不文明行为；<br>	
			</div>
	 </div>
	    <%@ include file="/static/htm/foot.jsp" %>	
	</body>
	<script type="text/javascript">
		$(document).ready(function(){
			if($("#error_info").css("visibility") == "hidden") {
				$("#error_info").hide();
				$("input[type=submit]").css("margin-top", "10px");
			}
			$("#submit").click(function(){
				if($("#title").val() == "") {
					$("#error_info").css("visibility","visible");
					$("#error_info").html("请输入标题");
					$("#error_info").show();
					return false;
				} else {
					return true;
				}
			});
		});
	</script>
</html>